/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import request from '@/utils/request';
import { isArray } from 'lodash';

export interface TodoListParams {
  phone?: string;
  page?: number;
  pageSize?: number;
  status: number;
}

// 快宝驿站加盟商，通知审核，获取列表
export async function getNoticeList(params: TodoListParams) {
  return request('/Inn/getLeagueNoticeList', {
    method: 'POST',
    data: params,
  }).then(({ data }) => {
    const { list, ...rest } = data || {};
    if (isArray(list) && list.length > 0) {
      return {
        ...rest,
        success: true,
        data: list,
      };
    }
    return {};
  });
}

// 快宝驿站加盟商，通知审核，同意或拒绝发布
export async function releaseNotice(params: any) {
  return request('/Inn/updateStatus', {
    data: params,
    method: 'POST',
  });
}

// 快宝驿站加盟商，通知审核，获取上一条或下一条审核内容
export async function getNoticeDetail(params: any) {
  return request('/Inn/noticeDetail', {
    data: params,
    method: 'POST',
  });
}
